<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.io.File"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.com.chinasoa.cms.portlet.action.*"%>
<%@ page import="com.x4ee.soa.portal.framework.tools.ConfigUtils"%>

<%String contextPath = request.getContextPath();%>
<portlet:defineObjects />
<form method='post' enctype="multipart/form-data" 
	action='<portlet:actionURL><portlet:param name="frameworkUri" value="uriUploadAction"/></portlet:actionURL>'>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr height="30">
    <th height="40" colspan="1" align="left"><img src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/URI.gif"/></th>
  </tr>	
	  <tr class="tr-light">
	    <td align="left" colspan="1">Name:<input name="uriName" type="text" size="10" class="textfield"/><br/>DIR：<select name="dirName">
	    <%File portletDir = FrameworkConfigWraper.getPortletDir(renderRequest);
		List portletSubDirList = new ArrayList();
		File[] portletSubDirFiles = portletDir.listFiles();
		for(int i=0;i<portletSubDirFiles.length;i++){
			File subDirFile = portletSubDirFiles[i];
			if(!subDirFile.getName().endsWith(".jsp")){
				if((!subDirFile.getName().equals("cms"))&&(!subDirFile.getName().equals("xml"))&&(!subDirFile.getName().equals("META-INF"))){
					%><option value="<%=subDirFile.getName()%>"><%=subDirFile.getName()%></option><%
				}
			}else{
			%><option value="jsp" selected="selected">jsp</option></select><%
			}
		}%><br/>
			File：<input name="uriJsp" type="file"/><br/>
			<input name="submitUriJsp" type="submit" value="上传"/>
		</td>
	  </tr>
	</table>
</form>
<form method='post'
	action='<portlet:actionURL><portlet:param name="frameworkUri" value="uriCreateAction"/></portlet:actionURL>'>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr height="30">
    <th height="40" colspan="1" align="left"><img src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/URI.gif"/></th>
  </tr>	
	  <tr class="tr-light">
	    <td align="left" colspan="1">Name:<input name="uriName" type="text" size="10" class="textfield"/><br/>JSP：<select name="jspName">
	    <%File jspDir = FrameworkConfigWraper.getPortletJspDir(renderRequest);
		List jspList = new ArrayList();
		File[] jspFiles = jspDir.listFiles();
		for(int i=0;i<jspFiles.length;i++){
			File jspFile = jspFiles[i];
			if(jspFile.getName().endsWith(".jsp")){
				jspList.add(jspFile.getName());
			}
		}
		for(Iterator jspIt = jspList.iterator();jspIt.hasNext();){
			String jspName = (String)jspIt.next();
			%><option value="<%=jspName%>"><%=jspName%></option><%
		}%>
			</select><br/><input name="submitJsp" type="submit" value="添加"/>
		</td>
	  </tr>
	  <tr class="tr-light">
	    <td height="40" colspan="1">
	    	<a href="<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="URITable"/></portlet:renderURL>">[URITable]</a>
	    	<a href="<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="OutletTable"/></portlet:renderURL>">[OutletTable]</a>
	    	<a href="<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="URICreate"/></portlet:renderURL>">[URICreate]</a>
			<a href="<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="OutletCreate"/></portlet:renderURL>">[OutletCreate]</a>    	
	    </td>
	  </tr>
	</table>
</form>